package m.olive.data.controller;

import m.framework.controller.BaseController;
import m.framework.controller.Task;
import m.framework.dao.selector.PageRecord;
import m.framework.dao.selector.Query;
import m.olive.data.model.DsParam;
import m.olive.data.service.DsParamService;

import org.springframework.stereotype.Controller;

@Controller
@Task("数据源参数")
public class DsParamController extends BaseController {
	
	@Task("数据源参数首页")
	public DsParam index(DsParam dsParam) {
		return dsParam;
	}
	
	@Task("准备新增数据源参数")
	public DsParam prepareInsert(DsParam dsParam) {
		return dsParam;
	}
	
	@Task("准备修改数据源参数")
	public DsParam prepareUpdate(DsParam dsParam) {
		return this.defultService().get(DsParam.class, dsParam.getDsParamId());
	}

	@Task("新增数据源参数")
	public DsParam insert(DsParam dsParam) {
		DsParamService dsParamService=this.getService(DsParamService.class);
		dsParam.setPk();
		dsParamService.insert(dsParam);
		return dsParam;
	}
	
	@Task("删除数据源参数")
	public DsParam delete(DsParam dsParam) {
		DsParamService dsParamService=this.getService(DsParamService.class);
		dsParamService.delete(dsParam);
		return dsParam;
	}
	
	@Task("修改数据源参数")
	public DsParam update(DsParam dsParam) {
		DsParamService dsParamService=this.getService(DsParamService.class);
		dsParamService.updateFull(dsParam);
		return dsParam;
	}

	@Task("查询数据源参数")
	public PageRecord query(Query<DsParam> query,PageRecord pageRecord){
		return this.defultService().queryPage(query, 1, pageRecord.getRowsPerPage());
	}
	
	@Task("翻页查询数据源参数")
	public PageRecord queryContinue(PageRecord pageRecord){
		return super.queryContinue(pageRecord);
	}

}
